package com.fund.user.controller;

import com.fund.common.pojo.Result;
import com.fund.user.pojo.vo.ClearingStatus;
import com.fund.user.service.SystemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/clearing")
public class SystemController {

    @Autowired
    SystemService systemService;

    //TODO 测试
    @GetMapping("/status")
    public Result<ClearingStatus> getClearingStatus() {
        return systemService.getStatus();
    }

    //TODO 测试
    @PostMapping("/initialize")
    public Result<Boolean> dailyInit(){
        return systemService.init();
    }

    @PostMapping("/settle")
    public Result<Boolean> settle(){
        return systemService.settle();
    }

    //TODO 每天凌晨定时将清算状态改为未初始化，每天定时初始化和结算（若未人工清算），
    // 假期和周末只进行工作日更新，不初始化和结算

}
